package com.qingke.easyjava.springhibernate.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qingke.easyjava.springhibernate.bean.Clazz;
import com.qingke.easyjava.springhibernate.bean.Student;

@Service
@Transactional
public class StudentService {
	@Autowired
	private HibernateManager hibernateManager;
	
	public void saveStudent(Student student){
		hibernateManager.save(student);
	}
	
	public void saveClazz(Clazz clazz){

		hibernateManager.save(clazz);
	}
	
	public List<Student> getAllStudent(){
		return hibernateManager.getAllList(Student.class);
	}
	
	public Clazz getClazzById(int id){
		return hibernateManager.getObjectById(Clazz.class, id);
	}
	public Clazz getClazzByName(String name){
		return hibernateManager.getObjectByName(Clazz.class, name);
	}

	
}
